home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / OpenDoc / OpenDoc Utilities / Interfaces / UseRsrcM.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-01  |  2.3 KB  |  92 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        UseRsrcM.h
  3.  
  4.     Contains:    Functions for using resources from the resource fork of a library
  5.  
  6.     Owned by:    Reggie Adkins
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Theory of Operation:
  11.     
  12.     This utility provides convenient access to a part editor's (or other shared
  13.     library's) resources -- a library's resource fork is _not_ by default open
  14.     or accessible. Please see the OpenDoc tech note "Using Resources" for full
  15.     instructions.
  16.     
  17.     Change History (most recent first):
  18.  
  19.          <3>      10/22/96    DH        1369514 Overhauled resource loading
  20.                                     functions so that a variety of places can
  21.                                     be searched for resources to load into temp
  22.                                     mem.
  23.          <2>     6/21/96    DH        1353507: 1.0.x: Dragging Scrapbook OpenDoc
  24.                                     clipping to document can cause crash. Added
  25.                                     function to read a resource fork that takes
  26.                                     a fileRefNum
  27.     To Do:
  28. */
  29.  
  30.  
  31. #ifndef _USERSRCM_
  32. #define _USERSRCM_
  33.  
  34. #ifndef _ODTYPES_
  35. #include "ODTypes.h"
  36. #endif
  37.  
  38. #ifndef _EXCEPT_
  39. #include "Except.h"
  40. #endif
  41.  
  42. #ifndef __CODEFRAGMENTS__
  43. #include <CodeFragments.h>
  44. #endif
  45.  
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51.  
  52. OSErr InitLibraryResources( CFragInitBlockPtr );
  53.  
  54. void  CloseLibraryResources( );
  55.  
  56.  
  57. ODSLong    BeginUsingLibraryResources( );
  58. void    EndUsingLibraryResources( ODSLong );
  59.  
  60.  
  61. ODHandle    ODReadResource( ResType type, short id );
  62. ODHandle    ODReadNamedResource( ResType type, ConstStr255Param name );
  63.  
  64. ODPtr        ODReadResourceToPtr( ResType type, short id );
  65. ODPtr        ODReadNamedResourceToPtr( ResType type, ConstStr255Param name );
  66.  
  67. void        ODGetString( Str255 str, short id );
  68. void        ODGetIndString( Str255 str, short id, short index );
  69.  
  70. void*         ODReadResourceUsingRefnum( short ResRefNum, ResType type, short id,
  71.                                ConstStr255Param name, ODBoolean asHandle );
  72. void*         ReadResourceIntoTempMem( ResType type, short id, ConstStr255Param name,
  73.                                ODBoolean asHandle );
  74. void*         ReadIndexedResourceIntoTempMem( ResType type, short index, ODBoolean asHandle );
  75.  
  76. #ifdef __cplusplus
  77.     } // ends extern "C"
  78.     
  79.     class CUsingLibraryResources :private Destructo {
  80.         public:
  81.             CUsingLibraryResources( )    {fRefNum=BeginUsingLibraryResources();}
  82.            ~CUsingLibraryResources( );
  83.         private:
  84.             ODSLong fRefNum;
  85.     };
  86.     
  87.     inline void BeginUsingLibraryResources( ODSLong &ref )    // param is for backward compatibility
  88.             {ref=BeginUsingLibraryResources();}
  89. #endif
  90.  
  91.  
  92. #endif /* _USERSRCM_ */